package com.project.controller;

import com.project.bean.UserBean;
import com.project.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    OrderService orderService;
    @GetMapping("myOrder")
    public Object myOrder(Integer pageNO,HttpServletRequest request){
        System.out.println("我的订单");
        //得到当前登录用户
        UserBean user= (UserBean) request.getSession().getAttribute("loginUser");
        return orderService.myOrderList(pageNO,user.getUserName());
    }
    @GetMapping("updateStatus")
    public String updateStatus(Integer orderId){
        return orderService.updateStatus(orderId);
    }
}
